﻿using GetHbaseDataTests.Helpers;
using Sustainalytics.ClientDW.Synchronization.SyncHbaseData;
using System;
using System.Collections.Generic;
using System.Configuration.Abstractions;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;

namespace GetHbaseDataTests
{
    public class SyncHbaseDataTests : BaseSyncHbaseTests
    {
        private readonly CorporateDataSync hBaseSync;

        public SyncHbaseDataTests(ITestOutputHelper output) : base(output)
        {
            hBaseSync = SimpleInjectorContainer.GetInstance<CorporateDataSync>();
        }

        [Fact]
        public async Task Start()
        {
            var identifierTypesIds = SimpleInjectorContainer.GetInstance<IAppSettings>()["IdentifierTypesIDs"]?.Replace(" ", string.Empty)
                                                            .Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
            
            await hBaseSync.Start(identifierTypesIds?.Length > 0 ? new HashSet<string>(identifierTypesIds) : null);
        }
    }
}
